package org.flashIso.engine.core {
	import flash.events.Event;
	
	import org.flashIso.engine.events.IsoEvent;

	/**
	 * @author Marius Dorin Moraru
	 */
	public class Point3DList extends ValidateableObject {
		private var _points : Array;

		public function Point3DList() {
			_points = new Array();
		}

		public function get length() : uint {
			return _points.length;
		}

		public function add(point : Point3D) : void {
			_points.push(point);
			point.addEventListener(Event.CHANGE, triggerValidation, false, 0, true);
			triggerValidation();
		}

		public function getPointAt(index : uint) : Point3D {
			return _points[index] as Point3D;
		}

		public function removeAll() : void {
			var i : uint;
			for (i = 0; i < _points.length; i++ ) {
				Point3D(_points[i]).removeEventListener(Event.CHANGE, triggerValidation);
			}
			_points = new Array();
			triggerValidation();
		}
	}
}
